package org.jspresso.framework.application.frontend.action.std;

import java.util.Map;

import org.jspresso.framework.action.IActionHandler;
import org.jspresso.model.TestEntity;

public class EditTestEntityAction<E,F,G> extends EditComponentAction<E,F,G> {

	@Override
	public boolean execute(IActionHandler actionHandler, Map<String, Object> context) {
		if(getComponentToEdit(context) == null) {
			return false;
		}
		return super.execute(actionHandler, context);
	}

	@Override
	protected Object getComponentToEdit(Map context) {
		if(getSelectedModel(context) != null && getSelectedModel(context) instanceof TestEntity) {
			return ((TestEntity)getSelectedModel(context)).getValue();
		}
		return null;
	};
}
